layui.use(['jquery', 'form', 'layer'], function () {
    var $ = layui.jquery;
    var form = layui.form;
    var layer = layui.layer;


    form.on('submit(addProjectFilter)', function (data) {
        var formData = data.field;
        var url = ctx + "/sale/addProject";

        var index = layer.msg("数据提交中，请稍后", {
            icon: 16,
            time: false,
            shade: 0.8
        })
        $.ajax({
            type: "post",
            data: formData,
            url: url,
            success: function (data) {

                if (data.code == 200) {
                    layer.msg(data.msg, {icon: 6});
                    top.layer.close(index);
                    top.layer.closeAll("iframe")
                    parent.location.reload();
                } else {
                    layer.msg(data.msg, {icon: 5})
                    layer.closeAll("iframe");
                }
            }, error: function (data) {
                layer.close(index);
                layer.msg(data.msg)
            }
        })
        return false;
    })

})